<?php

// +----------------------------------------------------------------------
// | 主页
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 微尘 <yicmf@qq.com>
// +----------------------------------------------------------------------

namespace app\controller\pos;

use app\common\controller\Base;
use app\event\app\ExchangeCoupon;
use app\event\app\ExchangeCoupon as ExchangeCouponEvent;
use app\event\app\Jd;
use app\event\app\Mt;
use app\event\app\Pdd;
use app\event\app\Tbk;
use app\event\app\ThirdRecharge;
use app\event\file\Image;
use app\event\im\Robot as RobotEvent;
use app\event\index\Task;
use app\event\pay\Bill as BillEvent;
use app\event\pay\PointOrder;
use app\event\pos\Pos as PosEvent;
use app\event\pos\PosOrder as PosOrderEvent;
use app\event\pos\PosTrade as PosTradeEvent;
use app\event\store\Store as StoreEvent;
use app\event\ucenter\IpPool;
use app\event\ucenter\User as UserEvent;
use app\model\app\GameOrder;
use app\model\app\JdPid;
use app\model\app\TbkPid;
use app\model\pay\Pay;
use app\model\pos\Pos;
use app\model\pos\PosTrade;
use app\model\ucenter\IpPool as IpPoolModel;
use app\model\ucenter\User;
use app\model\ucenter\User as UserModel;
use app\event\im\Chat as ChatEvent;
use app\model\ucenter\UserMoneyLog;
use Justmd5\PinDuoDuo\PinDuoDuo;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Log;
use think\facade\Validate;
use think\File;
use Topsdk\Topapi\Ability2138\Ability2138;
use Topsdk\Topapi\Ability369\Ability369;
use Topsdk\Topapi\Ability369\Request\TaobaoTbkDgOptimusPromotionRequest;
use Topsdk\Topapi\Ability370\Request\TaobaoTbkDgMaterialTemporaryOptionalRequest;
use Topsdk\Topapi\Ability374\Ability374;
use Topsdk\Topapi\Ability374\Request\TaobaoTbkActivityInfoGetRequest;
use Topsdk\Topapi\Defaultability\Defaultability;
use wechat\official_account\Template as TemplateOfficial;
use yicmf\tools\FlowSn;
use yicmf\tools\HttpService;
use Topsdk\Topapi\TopApiClient;
use Topsdk\Topapi\Ability370\Request\TaobaoTbkShopGetRequest;
use Topsdk\Topapi\Ability2138\Request\TaobaoTbkDgNewuserOrderGetRequest;
use Topsdk\Topapi\Ability370\Ability370;


class Index1 extends Common
{

    protected function initialize()
    {
        parent::initialize();
    }


    public function app()
    {
        return $this->fetch('index/index');
    }

    public function index()
    {
        return $this->fetch();
//
//        $re= UserEvent::f3BuserCheck();
//        dump($re);
//
//        return '1';
////        return $this->fetch();
//
//
//        $trade = User::where('id',1)->find();
//
//
//        dump($trade->moneys->toArray());
//
//        exit();
//        $trade = PosTrade::find(1982);
//        $pos = Pos::where('id',$trade['pos_id'])->find();
//
//        dump($trade->toArray());
//        dump($pos->toArray());
//
//        $event = new PosTradeEvent();
//        $re = $event->trade($trade,$pos);
//        dump($re);
//
//        exit();
//        if ($re['code'] != 0)
//        {
//            throw new Exception($re['message']);
//        }
//
//        $e = new PosEvent();
//        //终端返现
//        $pos = Pos::find(1097);
//
//        dump($pos->toArray());
//
//        return;
//        exit();

//
//        alipay_transfer(time(),0.01,'lilwil@163.com','刘伟');
//
//            exit();
//        $e = new PosEvent();
//        //终端返现
//        $re = $e->payback();
//
//        $log = config('log');
//        $log['default'] = 'task';
//
//        config($log,'log');
//
//        dump(config('log'));
//        $file = public_path().'aa.zip';
//
//        $file = new File($file);
//
//        dump(MD5_file($file));
//        $file = new \SplFileInfo($file);
//        dump($file);
//        halt($file);
        // 代理结算
//        BillEvent::agentMonth();
//        $pay = Pay::where('id',27)->find();
//
//        $event = new PosOrderEvent();
//        $event->pay($pay);

//        Cache::set('tips_service_say_21_1',12,10);

//        $m = Db::name('menu')->select();
//        foreach ($m as $index => $item) {
//            $u = [];
////            $u['controller'] = $item['module'].'/'. str_replace('.','/',$item['controller']);
//            $u['url'] = str_replace('.','/',$item['url']);
////            $u['module'] = '';
//            Db::name('menu')->where('id',$item['id'])->update($u);
//        }
        return 'ok';
    }




    public function test()
    {

//        dump(IpPool::task());
//        exit();
//        $str = 'N3500000078';
//        $num = 853;
//
//
//
//        for ($i = 0; $i < 100; $i++) {
//            echo $str.$num.'<br>';
//            $num++;
//        }
//
//        return 'ok';


        $pdd = new Pdd();;
//
        dump($pdd->checkOkPromotion());
        return'p';
        exit();
//        exit();
//        $user = UserModel::find(36);
//        $user = UserModel::find(36);
        $user = User::find(16006);
//        $user = UserModel::find(61);
//        dump($pdd->getOrderByUpdate(time(),86000));
        dump($pdd->parseContent('https://mobile.yangkeduo.com/goods1.html?ps=4AD8O2AHXV',$user));
//        dump($pdd->parseContent('https://mobile.yangkeduo.com/goods2.html?ps=PyXrrjXo3m',$user));
//        dump($pdd->parseContent('https://mobile.yangkeduo.com/goods1.html?ps=veAhhrByz4',$user));
        exit();


//        $config = [
//            'debug' => true,
//            'client_id' => 'ef4befb979244ce6b79226d242da1ebd',
//            'client_secret' => '8a27cee8fe779c54bfa0a18ec620648e24b611e8',
//            'redirect_uri' => 'https://yourdomain.com/callback',
//            'log' => [
//                'name' => 'pinduoduo',
//                'level' => 'debug',
//                'permission' => 0777,
//            ],
//        ];

        $pinduoduo = new PinDuoDuo($config);

        $result = $pinduoduo->api->request('pdd_ddk_goods_search', ['goods_sign' => 'Y9X2o23Pb-lfwWc1wvfZk0N5-QNj-R7b_JlrlXGK3D']);
        dump($result);

        exit();

        $game = GameOrder::select();


        foreach ($game as $item) {
            if (is_numeric($item['appsign']))
            {
                $item['user_id'] = $item['appsign'];
                $item->save();
            }

        }

        return 'ok';


        $jd = new Jd();


        dump($jd->getOrder(2, strtotime('2024-12-15 16:59:50')));


        exit();

        $po = new PointOrder();

        dump($po->fail());
        return;
        dump(IpPool::findInfo('222.142.19.125'));

        return;
        $data = IpPoolModel::whereRaw('create_time != update_time')->where('id','>',50)->select();
        if ($data)
        {

            foreach ($data as $index => $datum) {

                Db::name('ip_pool')->where('id',$datum['id'])->update(['update_time'=>$datum['create_time']]);
            }
        }


        dump(1);
        return;

        dump(\app\event\ucenter\User::area());
        return;
        $index = new ExchangeCoupon();
        $er = $index->info();
        dump($er);
        return;
        $order = new PosOrderEvent();
        $order->timeoutClose();

        dump(1);
        return;
        $app = new ThirdRecharge();


        dump($app->fail());
        return 'opk';
        exit();
        dump(UserMoneyLog::where('user_id', 16152)->where('modular_id', 6)->sum('money'));

        exit();



        $app = new ThirdRecharge();


        dump($app->test());
        exit();

        $jd = new Jd();


        dump($jd->getPromotion(1, strtotime('2024-12-17 13:55:35')));
//        dump($jd->getLike(2,time()));
        dump(3001 % 3);

        return;
        exit();
        //SELECT * FROM `fa_user_money_log` WHERE (`user_id` = 16152 ADD `modular_id` = 6)

        dump(UserMoneyLog::where('user_id', 16152)->where('modular_id', 6)->sum('money'));

        exit();
//        $jd = new Jd();
//
//
//        dump($jd->getOrder(2,time()));
//        dump(3001%3);
//
//        return;
//        exit();
//        $logs = UserMoneyLog::where('type',22)
//            ->sum('money')
//        ;
//
//
//        dump($logs);
//
//        exit();

        $app = new ThirdRecharge();


        dump($app->info());
        exit();
        $tas = new Task();

        dump($tas->restart());

        return 'ok';
        exit();

        dump(config('app_store.store_hot'));
        exit();

        $jd = new Jd();


        dump($jd->getOrder(1, strtotime('2024-12-16 08:46:54')));
        dump(3001 % 3);

        exit();

        $jd = new Jd();


        dump($jd->test());
        exit();


        $po = Db::name('point_order')->select();


        foreach ($po as $item) {
            $up['create_time'] = time_format($item['createtime']);
            $up['update_time'] = time_format($item['updatetime']);
            Db::name('point_order')->where('id', $item['id'])->update($up);
        }


        dump(1);
        exit();
        $mt = new Mt();


        $re = $mt->mtLink();

        dump($re);
        exit();

        dump(config('app_store.store_hot'));
        dump(config('ucenter.user_administrator'));


        dump(1);
        exit();
        $users = User::where('realName', 1)->select();


        foreach ($users as $index => $user) {

            dump($user['idCard']);
            $re = Validate::checkRule($user['idCard'], 'idCard');
            if ($re) {
                $br = get_idcard_birthday($user['idCard']);
                if ($br && '0000-00-00' != $br) {
                    $user['birthday'] = $br;
                    $user->save();
                }

            }


        }


        exit();

        dump($re);
        exit();
        $pattern = '/\d{6}(?=\d{8})/';
        $idCardNumber = '110101199001011234';
        preg_match($pattern, $idCardNumber, $matches);
        $birthday = date('Y-m-d', strtotime($matches[0]));

        dump($birthday);
        exit();

//        include_once app()->getRootPath() . 'extend/jd/JdSdk.php';
//
//
//        $c = new \JdClient();
//        $c->appKey = '438bee51947f8649d6e1c44475dde297';
//        $c->appSecret = 'f53764743a6a4532961a56c59897a88a';
//        $c->accessToken = 'aa';
//        $c->serverUrl = 'https://api.jd.com/routerjson';
//        $req = new \UnionOpenPromotionCommonGetRequest();
//        $promotionCodeReq= new \PromotionCodeReq();
//        $req->setPromotionCodeReq($promotionCodeReq);
//        $req->setVersion("1.0");
//        $resp = $c->execute($req, $c->accessToken);
//
//
//        dump($resp);
//        exit();

//        $pdd = new Jd();
//
//        $re = $pdd->getSinglePromotionUnionConvert('https://item.jd.com/10115213355097.html');
//
//        dump($re);
//        exit();
//        $jso = '{"code":200,"data":{"hasNext":false,"listType":0,"pageNo":4,"pageSize":20,"result":[{"createTime":"2024-12-06 13:53:28","id":3101146730,"pid":"2035795074_4101354001_3101146730","promotionName":"5","siteId":4101354001,"siteName":"线下社区推广","subTypeDesc":"社区","type":3,"typeStr":"导购媒体"},{"createTime":"2024-12-06 13:50:47","id":3101146728,"pid":"2035795074_4101354001_3101146728","promotionName":"4","siteId":4101354001,"siteName":"线下社区推广","subTypeDesc":"社区","type":3,"typeStr":"导购媒体"},{"createTime":"2024-12-06 13:50:40","id":3101146727,"pid":"2035795074_4101354001_3101146727","promotionName":"3","siteId":4101354001,"siteName":"线下社区推广","subTypeDesc":"社区","type":3,"typeStr":"导购媒体"},{"createTime":"2024-12-06 13:50:26","id":3101146726,"pid":"2035795074_4101354001_3101146726","promotionName":"2","siteId":4101354001,"siteName":"线下社区推广","subTypeDesc":"社区","type":3,"typeStr":"导购媒体"},{"createTime":"2024-12-05 14:36:47","id":3101145982,"pid":"2035795074_4101354001_3101145982","promotionName":"社区1","siteId":4101354001,"siteName":"线下社区推广","subTypeDesc":"社区","type":3,"typeStr":"导购媒体"}],"total":65},"message":"success","totalNum":0}';
//
//        $data = json_decode($jso,true);
//
//
//
//        $lists = $data['data']['result'];
//
//
//        foreach ($lists as $list) {
//            JdPid::create(['pid'=>$list['pid']]);
//        }
//        dump($lists);
//        exit();


        $tbk = new Pdd();

        $re = $tbk->getPddGoodsSearch(1);
//        $re  = $tbk->parseContent('https://detail.tmall.com/item.htm?ali_trackid=2%3Amm_2348210022_3168000038_115836850067%3A1733301788291_189920460_0&bxsign=tbkAeiZEdXJbb-OUKheGtfGeXkbim9CTbNNcLtp8LKHY5YHeQqwGUCDjBhG4GW9MPN6ZitlZaR-tXsoJZD1q6uPGHgcyRu0hqPanGu2uWUIjSTyLnP_SQG1nDoQpgDQoHjFQEde36dHoo7-6V6NsHZ0-pB1pWXnEaFvmnLoO8AMy0ad-s6CA8g2n_vJAw4zDsa5&id=44215426902&union_lens=lensId%3AMAPI%401733301762%406708_86637_65de1e69-4a83-4fcb-b9df-df9a02f43b73%401%40eyJmbG9vcklkIjo4ODYwM30ie%3Bscm%3A1007.15348.115058.6708_86637_65de1e69-4a83-4fcb-b9df-df9a02f43b73%3Brecoveryid%3A189920460_0%401733301788291');
////        $re  = $tbk->getOrder(time() - 3600*14,3600*2);
////        $re  = $tbk->parseContent('【淘宝】假一赔四 http://e.tb.cn/h.TWAViQnPVEOEe1w?tk=JIFf3viI6FA CZ3460 「袜子男款秋冬纯棉防臭100%长袜全棉黑色运动无骨春秋季中筒袜男士」
////点击链接直接打开 或者 淘宝搜索直接打开');
//        dump($re);exit();
//        $re  = $tbk->heightCommission();


        dump($re);
        return;
        exit();
        require_once '../extend/dtk/DtkClient.php';
        require_once '../extend/dtk/GetTipList.php';
        require_once '../extend/dtk/GetTbParseContent.php';
        require_once '../extend/dtk/GetPrivilegeLink.php';
        require_once '../extend/dtk/GetOrderDetails.php';

        //订单详情
        $client = new \GetOrderDetails();


        $client->setAppKey('675107a00b163');
        $client->setAppSecret('959b15cb9c214df2e8ebe9defa0aeb69');
        $client->setVersion('v3.0.0');

        $param['queryType'] = 1;
        $param['startTime'] = '2024-12-05 11:08:13';
        $param['endTime'] = '2024-12-05 12:08:13';
        $res = $client->setParams($param)->request();

        dump(json_decode($res, true));
        exit();
        //订单详情
        $client = new \GetPrivilegeLink();


        $client->setAppKey('675107a00b163');
        $client->setAppSecret('959b15cb9c214df2e8ebe9defa0aeb69');
        $client->setVersion('v3.0.0');

        $param['goodsId'] = 'rnnjQZbHOtVMB0Nk27uKaeuPuZ-x7Rp7Q2F5oJWvxzBt4';
        $param['promtionType'] = 2;
        $res = $client->setParams($param)->request();

        dump(json_decode($res, true));
        exit();
        //订单详情
        $client = new \GetTbParseContent();


        $client->setAppKey('675107a00b163');
        $client->setAppSecret('959b15cb9c214df2e8ebe9defa0aeb69');
        $client->setVersion('v3.0.0');

        $param['content'] = 'https://item.taobao.com/item.htm?id=565421454492';
        $param['externalId'] = '1011';
        $res = $client->setParams($param)->request();

        dump(json_decode($res, true));
        exit();

        //订单详情
        $client = new \GetOrderDetails();


        $client->setAppKey('675107a00b163');
        $client->setAppSecret('959b15cb9c214df2e8ebe9defa0aeb69');
        $client->setVersion('v3.0.0');

        $param['queryType'] = 1;
        $param['orderScene'] = 3;
//        $param['startTime'] = '2024-12-05 6:08:13';
//        $param['endTime'] = '2024-12-05 8:08:13';
        $param['startTime'] = '2024-12-04 15:00:13';
        $param['endTime'] = '2024-12-04 16:00:13';
        $res = $client->setParams($param)->request();

        dump(json_decode($res, true));
        exit();

        //线报api
        $client = new \GetTipList();

        $client->setAppKey('675107a00b163');
        $client->setAppSecret('959b15cb9c214df2e8ebe9defa0aeb69');
        $client->setVersion('v3.0.0');

        $res = $client->setParams([])->request();
        dump(json_decode($res, true));

        exit();

        $appkey = '675107a00b163';
        $appsecret = '959b15cb9c214df2e8ebe9defa0aeb69';


        $param['appkey'] = $appkey;
        $param['appsecret'] = $appsecret;

        $param['queryType'] = 1;
        $param['startTime'] = '2024-12-05 6:08:13';
        $param['endTime'] = '2024-12-05 8:08:13';
        $re = HttpService::get('https://openapi.dataoke.com/api/tb-service/get-order-details', $param);


        dump($re);
        exit();
// create Client
        $client = new TopApiClient("34963605", "ba2ce7ca7ac94385018cd22ed8cd593b", "http://gw.api.taobao.com/router/rest");


        $ability = new Ability374($client);

// create domain

// create request
        $request = new TaobaoTbkActivityInfoGetRequest();
        $request->setActivityMaterialId("123");
        $request->setAdzoneId('115836850067');
//        $request->setSubPid("mm_1_2_3");
//        $request->setRelationId(123);
        $request->setUnionId("demo");

        $response = $ability->taobaoTbkActivityInfoGet($request);
        dump($response);


        exit();
        $ability = new Defaultability($client);

// create domain

// create request
        $request = new TaobaoTbkDgMaterialRecommendRequest();
        $request->setPageSize(20);
        $request->setPageNo(1);
        $request->setMaterialId(123);
        $request->setAdzoneId(123);
        $request->setRelationId(123456);
        $request->setDeviceType("IMEI");
        $request->setDeviceEncrypt("MD5");
        $request->setDeviceValue("xxx");
        $request->setPromotionType("2");
        $request->setSpecialId("2323");
        $request->setItemId("qeqscd1231-uqwenqe");
        $request->setFavoritesId("123445");

        $response = $ability->taobaoTbkDgMaterialRecommend($request);
        dump($response);
        exit();
        $ability = new Ability369($client);

// create domain

// create request
        $request = new TaobaoTbkDgOptimusPromotionRequest();
        $request->setPageSize(10);
        $request->setPageNum(1);
        $request->setAdzoneId(115836850067);
        $request->setPromotionId(-37116);

        $response = $ability->taobaoTbkDgOptimusPromotion($request);
        dump($response);

        exit();
        $ability = new Ability2138($client);
        $request = new TaobaoTbkDgNewuserOrderGetRequest();
        $request->setPageSize(20);
        $request->setPageNo(1);
        $request->setAdzoneId('115836850067');
        /*
            2018-01-24 00:34:05
        */
        $request->setStartTime(date("Y-m-d H:i:s"));
        /*
            2018-01-24 00:34:05
        */
        $request->setEndTime(date("Y-m-d H:i:s"));
        $request->setActivityId("119013_2");

        $response = $ability->taobaoTbkDgNewuserOrderGet($request);
        dump($response);

        exit();

        $req = new TaobaoTbkDgNewuserOrderGetRequest;
        $req->setPageSize("20");
        $req->setPageNo("1");
        $req->setAdzoneId("115836850067");
        $req->setStartTime("2024-11-24 00:34:05");
        $req->setEndTime("2024-12-24 00:34:05");
        $req->setActivityId("119013_2");
        $resp = $client->execute($req);

        dump($resp);
        exit();
// create domain

// create request
        $request = new TaobaoTbkShopGetRequest();
        $request->setEndAuctionCount(200);
        $request->setEndCommissionRate(123);
        $request->setEndCredit(20);
        $request->setEndTotalAction(100);
        $request->setFields("user_id,shop_title,shop_type,seller_nick,pict_url,shop_url");
        $request->setIsTmall(false);
        $request->setPageNo(1);
        $request->setPageSize(20);
        $request->setPlatform(1);
        $request->setQ("女装");
        $request->setSort("commission_rate_des");
        $request->setStartAuctionCount(123);
        $request->setStartCommissionRate(2000);
        $request->setStartCredit(1);
        $request->setStartTotalAction(1);

        $response = $ability->taobaoTbkShopGet($request);
        dump($response);

        exit();


        $ta = \app\model\app\ExchangeCouponGroup::select();


        foreach ($ta as $item) {

            if (!\app\model\app\ExchangeCoupon::where('catalog_name', $item['name'])->find()) {
                $item->update(['status' => -2]);
            }

        }
        return 'ok';
//
//
//        $ta = \app\model\app\ExchangeCoupon::select();
//
//
//        foreach ($ta as $item) {
//            $item['catalog_name'] = trim($item['catalog_name']);
//            $item->save();
//
//        }


        exit();


        $param['openid'] = '000gtc_898445716798e40210b7a379d9d35bee65';
        $param['access_token'] = 'U1RzaWQwMDAwMDAxNzMzMjc3MDE1NDEwbGJZcXpEcDBZZUlnY2J3d0NLMW4wa0Zza3hVdGc0Rzh8fDF8djJ8MXw3MWIzYWFlYTZlYzI5OTQ2MjhlNDg4MTExZjAwYWEzNA==';
        $token = HttpService::post('https://fc-mp-306379bc-a8c3-47be-92a6-c4c0728572ed.next.bspapp.com/login', json_encode($param));
        $content = $token['content'];

        dump($token);
        exit();

        $index = new ExchangeCoupon();
        $index->fail();

        dump(1);
        return;
        exit();
        $index = new ExchangeCoupon();

        dump($index->balance());
        return;
        exit();;
////        $user = UserModel::where('is_agency',1)->select();
////
////
////        foreach ($user as $index => $item) {
////
////            $ids = UserModel::where('bid',$item['id'])->where('is_agency',0)->update(['agent_id'=>$item['id']]);
////
////        }
//
////        $sn = 'N6220HWL04';
////        $all = [];
////        for ($i = 3001; $i <= 3050; $i++) {
////
////            dump($sn.$i);
////            $sns[] = $sn.$i;
////            $pos =  Pos::where('sn',$sn.$i)->find();
////            if ($pos)
////            {
////                $pos->delete();
////            } else{
////                dump(1);
////            }
////
////        }
////        $re= Pos::where('sn','in',$sns)->delete();
////        dump($re);
////        dump($sns);
//        return 'ok';

        $trade = PosTrade::where('id', 1989)->find();
        $pos = Pos::where('id', $trade['pos_id'])->find();


        $event = new PosTradeEvent();
        $re = $event->trade($trade, $pos);

        dump($re);
        exit();
//        if ($re['code'] != 0) {
//            throw new Exception($re['message']);
//        }

        $logs = UserMoneyLog::whereNull('create_time')->select();


        foreach ($logs as $item) {
            $item['create_time'] = time_format($item['createtime']);
            $item['update_time'] = time_format($item['createtime']);
            $item->save();
        }


        return 'ok';

        $users = User::where('status', 1)->where('logintime', '<', time() - 86400 * 186)->where('money', '>', 0)->where('id', 'not in', [75, 98, 15583])->select();
        $c = User::where('status', 1)->where('logintime', '<', time() - 86400 * 186)
            ->where('money', '>', 0)
            ->where('id', 'not in', [75, 98, 15583])->count('money');

        dump($c);


//        $users = UserModel::where('status',1)->whereNull('last_login_time')->select();
//
//
        foreach ($users as $user) {
            $user['money'] = 0;
            $user->save();
        }

        dump(1);
        exit();

//        $sn = N6220DW1694987-5036//
//        N6220DW1694987-1695006

        exit();
        dump($all);

        $e = new Pos();
        $e->saveAll($all);
        exit();
//        $transferRes = alipay_transfer(time(),0.1,'lilwil@163.com','刘伟');
//        dump($transferRes);
//        exit();
        $users = User::where('status', 1)->select();


        foreach ($users as $index => $user) {


//            $up['create_time'] = time_format($cash['create_time']);
//            $up['update_time'] = time_format($cash['create_time']);
            $user['create_time'] = time_format($user['createtime']);
            $user['update_time'] = time_format($user['updatetime']);
            $user['is_push'] = 1;
            $user->save();
        }

        exit();
//
//        dump(1);
//        exit();
//
//        $user = UserModel::where('id',49)->find();
//
//
//        dump( password_verify('an123456', $user['password']));
//        dump( password_verify('qifan123', $user['password']));
//        dump($user['password']);
//        dump('test');
//        return 'ok';
//
        $cashs = Db::name('feed_back')->select();


        foreach ($cashs as $cash) {
            $up['create_time'] = time_format($cash['create_time']);

//            $up['status'] =$cash['status'];
            Db::name('feed_back')->where('id', $cash['id'])->update($up);
        }
//
//        dump('test');
        return 'ok';
        exit();
//        $re =alipay_transfer(time(),0.01,'lilwil@163.com','刘伟');
//
//        dump($re);
//        exit();

        $chat = \app\model\im\Chat::where('id', 3)->find();
        $re = RobotEvent::talk($chat, 'auto_say', null, 23);
        dump($re);
        halt(ChatEvent::timeoutClose());
        halt(FlowSn::build(1));
        halt(HttpService::get('https://doc.thinkphp.cn/v8_0/caches.html'));

        dump($this->port);

        exit();
        dump($this->request->host());
//        dump(version_compare('1.1.1','1.1.1'));
//        dump(version_compare('1.1.2','1.1.1'));
//        dump(version_compare('1.1.1','1.1.0'));
//        dump(version_compare('1.1.1DEV1','1.1.1'));
        dump(version_compare('1.1.1a', '1.1.1RC'));
//        dump(version_compare('1.1.1rc1','1.1.1rc2'));
//        dump(version_compare('1.1.1rc1','1.1.1ba'));
//        dump(version_compare('1.1.1rc1','1.1.1rc2'));
        return 'ok';
        halt(env('log.channel', 'debug'));
        $content = '<p>人工坐席忙，如需查询订单信息，请{$订单1查询}回复{$订单2查询}。</p>';
//        $content = '这是一段文本，{$ddd}其{$ddd}中以"start"开头。';


        halt($content);
        $text = '这是一段文本，{$ddd}其{$ddd}中以"start"开头。';
        $pattern = '/\{\$+([\u4e00-\u9fa5_a-zA-Z0-9_]{1,10})+\}/';
//        $text = '<div align="center">
//  <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
//    <tr valign="middle">
//      <td align="center"><h1>测试</h1></td>
//    </tr><tr>
//      <td align="center" valign="top" height="30"><form name="form2" method="post" action=""><!--#include file="../ljform.asp"-->
//      <input type="submit" name="Submit2" value="提交"></form></td>
//    </tr>
//</table></div>';
        preg_match_all($pattern, $text, $matches);
        dump($matches);
        exit();
        ChatEvent::sendWorkerJob(10775, ['type' => 'switch_service', 'content_id' => 537]);

        dump(1);
        exit();
//        $c = ChatContent::where('id',306)->find();
//        $reply = UserModel::where('status', 1)->field('id,create_time,status')
//            ->order('create_time ASC')->limit(10) ->fetchSql(true)
//            ->select();;
//        dump($reply);
////        $reply = UserModel::where('status', 1)->field('id,create_time,status')
////            ->order('create_time','ASC')->limit(10)->buildSql();
////
//        halt($reply);
//        $event = new ChatEvent();
//        // 访客问询，机器人答复
//        $re = $event->ai($c, $c->user);
//        dump($re);
//        halt($c);
//        $chat = new \app\event\im\Chat();
//        dump($chat->timeoutClose());
//        dump(1);
//        $service = UserModel::where('store_id',1)->where('is_open',1)->orderRaw('RAND()')->find();
        $service = User::where('store_id', 1)->where('is_open', 1)->orderRaw('RAND()')->value('id');
        dump($service);
        return 'ok';
        return $this->fetch();
    }


}
